package com.supor.aiot.md_msg.api;

import com.android.baseconfig.base.BaseApiResult;
import com.android.baseconfig.base.BaseRetrofit;
import com.supor.aiot.common.entity.Result;
import com.supor.aiot.md_msg.entity.MsgCenterListResultBean;

import io.reactivex.rxjava3.core.Observable;
import okhttp3.RequestBody;

/**
 * @author: zook
 * @date: 2021/10/14
 */
public class MsgCenterApiImpl extends BaseRetrofit<MsgCenterApiService> implements MsgCenterApiService {
    private static MsgCenterApiImpl instance;

    public static MsgCenterApiImpl getInstance() {
        if (instance == null) {
            instance = new MsgCenterApiImpl();
        }
        return instance;
    }

    @Override
    public Observable<BaseApiResult<MsgCenterListResultBean>> getMsgList(String bossUserId,
                                                                         String messageType,
                                                                         String orderby,
                                                                         int limit, int page) {
        return api.getMsgList(bossUserId, messageType, orderby, limit, page).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<MsgCenterListResultBean>> getMsgListUnReadCount(
            String bossUserId, String messageType, String orderby, int isRead, int limit, int page) {
        return api.getMsgListUnReadCount(bossUserId, messageType, orderby, isRead, limit, page).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<MsgCenterListResultBean>> getReplyMsgList(String bossUserId, String note, String messageType, String orderby, int limit, int page) {
        return api.getReplyMsgList(bossUserId, note, messageType, orderby, limit, page).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<MsgCenterListResultBean>> getLikeMsgList(String bossUserId, String note, String messageType, String orderby, int limit, int page) {
        return api.getReplyMsgList(bossUserId, note, messageType, orderby, limit, page).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<MsgCenterListResultBean>> getReplyMsgListUnreadNum(String bossUserId, String note, String messageType, String orderby, int isRead, int limit, int page) {
        return api.getReplyMsgListUnreadNum(bossUserId, note, messageType, orderby, isRead, limit, page).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<MsgCenterListResultBean>> getLikeMsgListUnreadNum(String bossUserId, String note, String messageType, String orderby, int isRead, int limit, int page) {
        return api.getLikeMsgListUnreadNum(bossUserId, note, messageType, orderby, isRead, limit, page).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<String>> cleanRead(int isRead) {
        return api.cleanRead(isRead).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<String>> delAllMsg(int isDel) {
        return api.delAllMsg(isDel).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<String>> msgRead(String id, RequestBody requestBody) {
        return api.msgRead(id, requestBody).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<String>> delMsg(String id) {
        return api.delMsg(id).compose(this.applySchedulers());
    }
}